import 'package:eplorex/models/message/message.dart';

class MesssageUtil {
  static List<Message> mergeMessage(List<Message> left, List<Message?> main) {
    Map<String, Message> map = {};
    for (var element in left) {
      if (element != null) {
        map[element.id] = element;
      }
    }

    for (var element in main) {
      if (element != null) {
        map[element.id] = element;
      }
    }

    return map.values.toList();
  }
}
